package cn.zj.note.util;

import javafx.util.Pair;

import java.time.LocalDateTime;

public class StrFmtUtil {
    public static String fmtDate(LocalDateTime time) {
        return DateUtil.long2String(DateUtil.localDateTime2Long(time), DateDtf.yyyyMMdd_HHmmss);
    }

    public static LocalDateTime fmtDate(String timeStr) {
        return DateUtil.string2LocalDateTime(timeStr, DateDtf.yyyyMMdd_HHmmss);
    }

    public static Pair<String, String> splitUrlFromContent(String content) {
        String generalString = "";
        String httpString = "";

        int index = content.indexOf("http://");
        if (index == -1) {
            index = content.indexOf("https://");
        }
        if(index == -1){
            generalString = content;
        }else {
            generalString = content.substring(0, index);
            httpString = content.substring(index);
        }
        return new Pair<>(generalString, httpString);
    }

}
